package cn.wolfcode.p2p.base.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.text.DateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 视频认证
 */
@Getter
@Setter
public class VideoAuth extends AuditBaseDomain {
    /**
     * 预约时间
     */
    private OrderTime orderTime;
    /**
     * 预约日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date orderDate;

    /**
     * 显示预约时间
     */
    public String orderTimeDisplay(){
        return DateFormat.getDateInstance().format(orderDate) + " " + orderTime.orderTime();
    }

    /**
     * json
     */
    public String getJsonString(){
        Map<String,Object> map = new HashMap<>();
        map.put("id",getId());
        map.put("username",applier.getUsername());
        map.put("orderTime",orderTime.orderTime());
        map.put("remark",remark);
        return JSON.toJSONString(map);
    }
}